<!DOCTYPE html>
<html lang="zh">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="dromara.org" />
	<meta name="description" content="dromara.org" />
	<!-- 网页标签标题 -->
	<title>dromara(Open source organization)</title>
	<link rel="shortcut icon" href="/website/img/docsite.ico"/>
	<link rel="stylesheet" href="/website/build/documentation.css" />
</head>
<body>
	<div id="root"><div class="documentation-page" data-reactroot=""><header class="header-container header-container-normal"><div class="header-body"><a href="/website/zh-cn/index.html"><img class="logo" src="/website/img/dromara.png"/></a><div class="search search-normal"><span class="icon-search"></span></div><div class="header-menu"><img class="header-menu-toggle" src="/website/img/system/menu_gray.png"/><ul><li class="menu-item menu-item-normal"><a href="/website/zh-cn/index.html" target="_self">首页</a></li><li class="menu-item menu-item-normal menu-item-normal-active"><a href="/website/zh-cn/docs/soul/soul.html" target="_self">文档</a></li><li class="menu-item menu-item-normal"><a href="/website/zh-cn/blog/index.html" target="_self">博客</a></li><li class="menu-item menu-item-normal"><a href="/website/zh-cn/community/index.html" target="_self">社区</a></li></ul></div></div></header><div class="bar"><div class="bar-body"><img src="/website/img/system/docs.png" class="front-img"/><span>文档</span><img src="/website/img/system/docs.png" class="back-img"/></div></div><section class="content-section"><div class="sidemenu"><div class="sidemenu-toggle"><img src="https://img.alicdn.com/tfs/TB1E6apXHGYBuNjy0FoXXciBFXa-200-200.png"/></div><ul><li class="menu-item menu-item-level-1"><span>Soul</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/soul.html" target="_self">soul介绍</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/db.html" target="_self">数据库设计</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/config.html" target="_self">配置中心设计</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/request.html" target="_self">请求参数设计</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/selector.html" target="_self">选择器规则设计</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/preFilter.html" target="_self">前置过滤器设计</a></li><li style="height:324px;overflow:hidden" class="menu-item menu-item-level-2"><span>插件介绍<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/divide.html" target="_self">divide插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/dubbo.html" target="_self">dubbo插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/springcloud.html" target="_self">springcloud插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/rateLimiter.html" target="_self">rateLimiter插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/monitor.html" target="_self">monitor插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/waf.html" target="_self">waf插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/sign.html" target="_self">sign插件</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/rewrite.html" target="_self">rewrite插件</a></li></ul></li><li style="height:108px;overflow:hidden" class="menu-item menu-item-level-2"><span>部署文档<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/admin.html" target="_self">部署admin</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/soul/server.html" target="_self">部署server</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/http.html" target="_self">使用手册</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/soul/extend.html" target="_self">扩展文档</a></li></ul></li><li class="menu-item menu-item-level-1"><span>Hmily</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/hmily/index.html" target="_self">介绍文档</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/hmily/configuration.html" target="_self">配置详解</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/hmily/admin.html" target="_self">启动admin</a></li><li style="height:144px;overflow:hidden" class="menu-item menu-item-level-2"><span>用户文档<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/hmily/user-dubbo.html" target="_self">dubbo用户</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/hmily/user-motan.html" target="_self">motan用户</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/hmily/user-springcloud.html" target="_self">springcloud用户</a></li></ul></li><li style="height:108px;overflow:hidden" class="menu-item menu-item-level-2"><span>快速体验<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/hmily/quick-start-dubbo.html" target="_self">quick-start-dubbo</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/hmily/quick-start-springcloud.html" target="_self">quick-start-springcloud</a></li></ul></li></ul></li><li class="menu-item menu-item-level-1"><span>raincat</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/raincat/index.html" target="_self">介绍文档</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/raincat/start-manager.html" target="_self">启动raincat-manager</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/raincat/config.html" target="_self">配置详解</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/raincat/admin.html" target="_self">启动admin</a></li><li style="height:144px;overflow:hidden" class="menu-item menu-item-level-2"><span>用户文档<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/raincat/user-dubbo.html" target="_self">dubbo用户</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/raincat/user-motan.html" target="_self">motan用户</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/raincat/user-springcloud.html" target="_self">springcloud用户</a></li></ul></li><li style="height:108px;overflow:hidden" class="menu-item menu-item-level-2"><span>快速体验<img style="transform:rotate(0deg)" class="menu-toggle" src="/website/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/raincat/quick-start-dubbo.html" target="_self">quick-start-dubbo</a></li><li class="menu-item menu-item-level-3"><a href="/website/zh-cn/docs/raincat/quick-start-springcloud.html" target="_self">quick-start-springcloud</a></li></ul></li></ul></li><li class="menu-item menu-item-level-1"><span>myth</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/website/zh-cn/docs/myth/index.html" target="_self">介绍文档</a></li></ul></li></ul></div><div class="doc-content markdown-body"><ul>
<li>Soul是对接Http请求的网关，所以对请求参数有自己的规定。</li>
<li>请求参数格式如下：
网关的请求参数为：</li>
</ul>
<pre><code class="language-java"><span class="hljs-keyword">package</span> org.dromara.soul.web.request;

<span class="hljs-keyword">import</span> lombok.Data;
<span class="hljs-keyword">import</span> org.dromara.soul.common.constant.Constants;
<span class="hljs-keyword">import</span> org.dromara.soul.common.enums.HttpMethodEnum;
<span class="hljs-keyword">import</span> org.dromara.soul.common.enums.RpcTypeEnum;
<span class="hljs-keyword">import</span> org.springframework.http.server.reactive.ServerHttpRequest;

<span class="hljs-keyword">import</span> java.io.Serializable;

<span class="hljs-comment">/**
 * the soul request DTO .
 *
 * <span class="hljs-doctag">@author</span> xiaoyu(Myth)
 */</span>
<span class="hljs-meta">@Data</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">RequestDTO</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">Serializable</span> </span>{

    <span class="hljs-comment">/**
     * is module data.
     */</span>
    <span class="hljs-keyword">private</span> String <span class="hljs-keyword">module</span>;

    <span class="hljs-comment">/**
     * is method name .
     */</span>
    <span class="hljs-keyword">private</span> String method;

    <span class="hljs-comment">/**
     *  is rpcType data.  now we only support "http","dubbo" "motan","grpc".
     *  {<span class="hljs-doctag">@linkplain</span> RpcTypeEnum}
     */</span>
    <span class="hljs-keyword">private</span> String rpcType;

    <span class="hljs-comment">/**
     *  httpMethod  now we only support "get","post" .
     * {<span class="hljs-doctag">@linkplain</span>  HttpMethodEnum}
     */</span>
    <span class="hljs-keyword">private</span> String httpMethod;

    <span class="hljs-comment">/**
     * this is sign .
     */</span>
    <span class="hljs-keyword">private</span> String sign;

    <span class="hljs-comment">/**
     * timestamp .
     */</span>
    <span class="hljs-keyword">private</span> String timestamp;

    <span class="hljs-comment">/**
     * appKey .
     */</span>
    <span class="hljs-keyword">private</span> String appKey;

    <span class="hljs-comment">/**
     * content is json data.
     */</span>
    <span class="hljs-keyword">private</span> String content;

    <span class="hljs-comment">/**
     * extInfo is json data .
     */</span>
    <span class="hljs-keyword">private</span> String extInfo;

    <span class="hljs-comment">/**
     * ServerHttpRequest transform RequestDTO .
     *
     * <span class="hljs-doctag">@param</span> request {<span class="hljs-doctag">@linkplain</span> ServerHttpRequest}
     * <span class="hljs-doctag">@return</span> RequestDTO request dto
     */</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> RequestDTO <span class="hljs-title">transform</span><span class="hljs-params">(<span class="hljs-keyword">final</span> ServerHttpRequest request)</span> </span>{
        <span class="hljs-keyword">final</span> String <span class="hljs-keyword">module</span> = request.getHeaders().getFirst(Constants.MODULE);
        <span class="hljs-keyword">final</span> String method = request.getHeaders().getFirst(Constants.METHOD);
        <span class="hljs-keyword">final</span> String appKey = request.getHeaders().getFirst(Constants.APP_KEY);
        <span class="hljs-keyword">final</span> String httpMethod = request.getHeaders().getFirst(Constants.HTTP_METHOD);
        <span class="hljs-keyword">final</span> String rpcType = request.getHeaders().getFirst(Constants.RPC_TYPE);
        <span class="hljs-keyword">final</span> String sign = request.getHeaders().getFirst(Constants.SIGN);
        <span class="hljs-keyword">final</span> String timestamp = request.getHeaders().getFirst(Constants.TIMESTAMP);
        RequestDTO requestDTO = <span class="hljs-keyword">new</span> RequestDTO();
        requestDTO.setModule(<span class="hljs-keyword">module</span>);
        requestDTO.setMethod(method);
        requestDTO.setAppKey(appKey);
        requestDTO.setHttpMethod(httpMethod);
        requestDTO.setRpcType(rpcType);
        requestDTO.setSign(sign);
        requestDTO.setTimestamp(timestamp);
        <span class="hljs-keyword">return</span> requestDTO;
    }

}

</code></pre>
<ul>
<li>参数都需要通过Http请求头进行设置，请求头的字段在使用文档中介绍。当然用户也可以自己定义额外增加字段。</li>
</ul>
</div></section><footer class="footer-container"><div class="footer-body"><img src="/website/img/dromara.png"/><div class="cols-container"><div class="col col-12"><h3>免责声明</h3><p>任何单位或个人转载本网站的所有相关信息，请注明来源。</p></div><div class="col col-6"><dl><dt>文档</dt><dd><a href="/website/zh-cn/docs/soul/soul.html" target="_self">概览</a></dd><dd><a href="/website/zh-cn/docs/soul/soul.html" target="_self">快速开始</a></dd><dd><a href="/website/zh-cn/docs/soul/soul.html" target="_self">开发者指南</a></dd></dl></div><div class="col col-6"><dl><dt>资源</dt><dd><a href="/website/zh-cn/blog/index.html" target="_self">博客</a></dd><dd><a href="/website/zh-cn/community/index.html" target="_self">社区</a></dd></dl></div></div><div class="copyright"><span>Copyright ©2018 549477611@qq.com by xiaoyu</span></div></div></footer></div></div>
	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
	<script>
		window.rootPath = '/website';
  </script>
	<script src="/website/build/documentation.js"></script>
</body>
</html>